<?php
namespace Home\Controller;

class IndexController extends BaseController {

    public function index(){
        $posts = D('Posts')->limit(5)->order('id desc')->select();
        foreach ($posts as $k=>$v){
            $posts[$k]['content'] = stringToText($v['content'], 30);
        }

        $this->assign('posts', $posts);
//
//        $infoList = D('Info')->where([])->page(1, 6)->order('id desc')->select();
//        foreach ($posts as $k=>$v){
//            $posts[$k]['info'] = stringToText($v['content'], 30);
//            $posts[$k]['time'] = $v['send_date'];
//
//            unset($v['content']);
//            unset($v['send_date']);
//        }
//        $infoList = D('InfoCate')->parseFieldValueByRelateKey($infoList, 'cate_id', 'title', 'tag');
//
//        $this->assign('info_list', $infoList);


        $this->display();
    }

}